package com.ysd.lis.controller;

import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.WkKnowledgeTestQuestion;
import com.ysd.lis.request.TestQuestionRequest;
import com.ysd.lis.service.WkKnowledgeTestQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *
 * @author LuoXS
 * @date 2024/4/3
 * version 1.0
 */
@Api(tags = "知识库试卷题目")
@RestController
@RequestMapping("/api/wk/knowledge/test-question")
public class WkKnowledgeTestQuestionController extends BaseController {

    @Autowired
    WkKnowledgeTestQuestionService service;

    @ApiOperation("知识库试卷题目-试题列表（分页）")
    @GetMapping("/page")
    public Result pageList(TestQuestionRequest.PageListParam pageParam) {
        return service.pageList(pageParam);
    }

    @ApiOperation("获取知识库试卷题目-试题列表")
    @GetMapping("/get/{id}")
    public Result get(@PathVariable("id") String id) {
        return service.get(id);
    }


    @ApiOperation("新增")
    @PostMapping("/add")
    @LogDetail(requestParam = "add", operationType = OperationType.INSERT, module = "知识库试卷题目", content = "新增试题", businessName = "bacBase")
    public Result add(@RequestBody WkKnowledgeTestQuestion params) {
        return service.add(params);
    }

    @ApiOperation("修改")
    @PostMapping("/update")
    @LogDetail(requestParam = "update", operationType = OperationType.UPDATE, module = "知识库试卷题目-试题", content = "编辑试题", businessName = "bacBase")
    public Result update(@RequestBody WkKnowledgeTestQuestion params) {
        return service.edit(params);
    }

    @ApiOperation("删除")
    @PostMapping("/delete")
    @LogDetail(requestParam = "delete", operationType = OperationType.DELETE, module = "知识库试卷题目-试题", content = "删除试题", businessName = "bacBase")
    public Result delete(@RequestBody TestQuestionRequest.DeleteParam deleteParam) {
        return service.delete(deleteParam);
    }

}
